package net.huashitong.Indicators.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.Indicators.dao.ThreeIndexDao;
import net.huashitong.Indicators.entity.ThreeIndex;
import net.huashitong.Indicators.filter.ThreeIndexFilter;
import net.huashitong.Indicators.requestModel.IndexRequestModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ThreeIndexService extends StringPKService<ThreeIndex> {

    @Autowired
    private ThreeIndexDao dao;
    @Autowired
    private SysTableService tabservice;

    @Override
    protected BaseDao<ThreeIndex, String> getDao() {
        return dao;
    }

    @Override
    protected void beforeSave(ThreeIndex obj) {
        obj.setSysId(tabservice.updateMaxSysId( "AB03",null));
    }

    public List<ThreeIndex> queryThreeIndex(ThreeIndexFilter filter){
        return dao.queryThreeIndex(filter);
    }

    public List<ThreeIndex> getThreeIndexsByParentcode(IndexRequestModel filter)
    {
       return  dao.queryByThree(filter);
    }


}
